(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 7.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[      7789,        283]
NotebookOptionsPosition[      6996,        250]
NotebookOutlinePosition[      7361,        266]
CellTagsIndexPosition[      7318,        263]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[{
 RowBox[{
  RowBox[{"a", "=", 
   RowBox[{"{", 
    RowBox[{"ax", ",", "ay", ",", "0"}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"b", "=", 
   RowBox[{"{", 
    RowBox[{"bx", ",", "by", ",", "0"}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"a1", "=", 
   RowBox[{"{", 
    RowBox[{"a1x", ",", "a1y", ",", "0"}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"b1", "=", 
   RowBox[{"{", 
    RowBox[{"b1x", ",", "b1y", ",", "0"}], "}"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{"k", "=", 
  FractionBox[
   SqrtBox[
    RowBox[{
     SuperscriptBox["bx", "2"], "+", 
     SuperscriptBox["by", "2"]}]], 
   SqrtBox[
    RowBox[{
     SuperscriptBox["ax", "2"], "+", 
     SuperscriptBox["ay", "2"]}]]]}]}], "Input"],

Cell[BoxData[
 FractionBox[
  SqrtBox[
   RowBox[{
    SuperscriptBox["bx", "2"], "+", 
    SuperscriptBox["by", "2"]}]], 
  SqrtBox[
   RowBox[{
    SuperscriptBox["ax", "2"], "+", 
    SuperscriptBox["ay", "2"]}]]]], "Output"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"eq", "=", 
  RowBox[{
   RowBox[{"{", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      RowBox[{
       RowBox[{"(", 
        RowBox[{
         SuperscriptBox["a1x", "2"], "+", 
         SuperscriptBox["a1y", "2"]}], ")"}], 
       SuperscriptBox["k", "2"]}], "\[Equal]", 
      RowBox[{
       SuperscriptBox["b1x", "2"], "+", 
       SuperscriptBox["b1y", "2"]}]}], "\[IndentingNewLine]", "&&", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Cross", "[", 
         RowBox[{"a", ",", "a1"}], "]"}], "\[LeftDoubleBracket]", "3", 
        "\[RightDoubleBracket]"}], 
       SuperscriptBox["k", "2"]}], "\[Equal]", " ", 
      RowBox[{
       RowBox[{"Cross", "[", 
        RowBox[{"b", ",", "b1"}], "]"}], "\[LeftDoubleBracket]", "3", 
       "\[RightDoubleBracket]"}]}]}], "\[IndentingNewLine]", "}"}], "[", 
   RowBox[{"[", "1", "]"}], "]"}]}]], "Input"],

Cell[BoxData[
 RowBox[{
  RowBox[{
   FractionBox[
    RowBox[{
     RowBox[{"(", 
      RowBox[{
       SuperscriptBox["a1x", "2"], "+", 
       SuperscriptBox["a1y", "2"]}], ")"}], " ", 
     RowBox[{"(", 
      RowBox[{
       SuperscriptBox["bx", "2"], "+", 
       SuperscriptBox["by", "2"]}], ")"}]}], 
    RowBox[{
     SuperscriptBox["ax", "2"], "+", 
     SuperscriptBox["ay", "2"]}]], "\[Equal]", 
   RowBox[{
    SuperscriptBox["b1x", "2"], "+", 
    SuperscriptBox["b1y", "2"]}]}], "&&", 
  RowBox[{
   FractionBox[
    RowBox[{
     RowBox[{"(", 
      RowBox[{
       RowBox[{"a1y", " ", "ax"}], "-", 
       RowBox[{"a1x", " ", "ay"}]}], ")"}], " ", 
     RowBox[{"(", 
      RowBox[{
       SuperscriptBox["bx", "2"], "+", 
       SuperscriptBox["by", "2"]}], ")"}]}], 
    RowBox[{
     SuperscriptBox["ax", "2"], "+", 
     SuperscriptBox["ay", "2"]}]], "\[Equal]", 
   RowBox[{
    RowBox[{"b1y", " ", "bx"}], "-", 
    RowBox[{"b1x", " ", "by"}]}]}]}]], "Output"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"sol", "=", 
  RowBox[{"Simplify", "[", 
   RowBox[{"Solve", "[", 
    RowBox[{"eq", ",", 
     RowBox[{"{", 
      RowBox[{"a1x", ",", "a1y"}], "}"}]}], "]"}], "]"}]}]], "Input"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"a1x", "\[Rule]", 
      RowBox[{"-", 
       FractionBox[
        RowBox[{
         RowBox[{"ax", " ", "b1x", " ", "bx"}], "+", 
         RowBox[{"ay", " ", "b1y", " ", "bx"}], "-", 
         RowBox[{"ay", " ", "b1x", " ", "by"}], "+", 
         RowBox[{"ax", " ", "b1y", " ", "by"}]}], 
        RowBox[{
         SuperscriptBox["bx", "2"], "+", 
         SuperscriptBox["by", "2"]}]]}]}], ",", 
     RowBox[{"a1y", "\[Rule]", 
      RowBox[{"-", 
       FractionBox[
        RowBox[{
         RowBox[{"ay", " ", "b1x", " ", "bx"}], "-", 
         RowBox[{"ax", " ", "b1y", " ", "bx"}], "+", 
         RowBox[{"ax", " ", "b1x", " ", "by"}], "+", 
         RowBox[{"ay", " ", "b1y", " ", "by"}]}], 
        RowBox[{
         SuperscriptBox["bx", "2"], "+", 
         SuperscriptBox["by", "2"]}]]}]}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"a1x", "\[Rule]", 
      FractionBox[
       RowBox[{
        RowBox[{"ax", " ", "b1x", " ", "bx"}], "-", 
        RowBox[{"ay", " ", "b1y", " ", "bx"}], "+", 
        RowBox[{"ay", " ", "b1x", " ", "by"}], "+", 
        RowBox[{"ax", " ", "b1y", " ", "by"}]}], 
       RowBox[{
        SuperscriptBox["bx", "2"], "+", 
        SuperscriptBox["by", "2"]}]]}], ",", 
     RowBox[{"a1y", "\[Rule]", 
      FractionBox[
       RowBox[{
        RowBox[{"ay", " ", "b1x", " ", "bx"}], "+", 
        RowBox[{"ax", " ", "b1y", " ", "bx"}], "-", 
        RowBox[{"ax", " ", "b1x", " ", "by"}], "+", 
        RowBox[{"ay", " ", "b1y", " ", "by"}]}], 
       RowBox[{
        SuperscriptBox["bx", "2"], "+", 
        SuperscriptBox["by", "2"]}]]}]}], "}"}]}], "}"}]], "Output"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Refine", "[", 
  RowBox[{"sol", ",", 
   RowBox[{
    RowBox[{"ay", "\[Equal]", "1"}], "&&", 
    RowBox[{"ax", "\[Equal]", "1"}], "&&", 
    RowBox[{"bx", "\[Equal]", "2"}], "&&", 
    RowBox[{"by", "\[Equal]", "0"}], "&&", 
    RowBox[{"b1x", "\[Equal]", "2"}], "&&", 
    RowBox[{"b1y", "\[Equal]", 
     RowBox[{"-", "1"}]}]}]}], "]"}]], "Input"],

Cell[BoxData[
 RowBox[{"{", 
  RowBox[{
   RowBox[{"{", 
    RowBox[{
     RowBox[{"a1x", "\[Rule]", 
      RowBox[{"-", 
       FractionBox["1", "2"]}]}], ",", 
     RowBox[{"a1y", "\[Rule]", 
      RowBox[{"-", 
       FractionBox["3", "2"]}]}]}], "}"}], ",", 
   RowBox[{"{", 
    RowBox[{
     RowBox[{"a1x", "\[Rule]", 
      FractionBox["3", "2"]}], ",", 
     RowBox[{"a1y", "\[Rule]", 
      FractionBox["1", "2"]}]}], "}"}]}], "}"}]], "Output"]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"Refine", "[", 
  RowBox[{
   RowBox[{
    RowBox[{"ax", " ", "b1x", " ", "bx"}], "-", 
    RowBox[{"ay", " ", "b1y", " ", "bx"}], "+", 
    RowBox[{"ay", " ", "b1x", " ", "by"}], "+", 
    RowBox[{"ax", " ", "b1y", " ", "by"}]}], ",", " ", 
   RowBox[{
    RowBox[{"ay", "\[Equal]", "1"}], "&&", 
    RowBox[{"ax", "\[Equal]", "1"}], "&&", 
    RowBox[{"bx", "\[Equal]", "2"}], "&&", 
    RowBox[{"by", "\[Equal]", "0"}], "&&", 
    RowBox[{"b1x", "\[Equal]", "2"}], "&&", 
    RowBox[{"b1y", "\[Equal]", 
     RowBox[{"-", "1"}]}]}]}], "]"}]], "Input"],

Cell[BoxData["6"], "Output"]
}, Open  ]]
},
WindowSize->{1802, 1031},
WindowMargins->{{-5, Automatic}, {Automatic, -5}},
Magnification->2,
FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (November 10, 2008)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[567, 22, 794, 30, 274, "Input"],
Cell[1364, 54, 228, 9, 117, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[1629, 68, 902, 26, 179, "Input"],
Cell[2534, 96, 983, 35, 94, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[3554, 136, 202, 6, 57, "Input"],
Cell[3759, 144, 1709, 48, 153, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[5505, 197, 374, 10, 57, "Input"],
Cell[5882, 209, 453, 16, 79, "Output"]
}, Open  ]],
Cell[CellGroupData[{
Cell[6372, 230, 577, 15, 57, "Input"],
Cell[6952, 247, 28, 0, 57, "Output"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)

